
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
        <title>Materias Disponibles</title>
        <link media="all" href="../css/view.css" type="text/css" rel="stylesheet" />
        <script src="../css/view.js" type="text/javascript"></script>
    </head>
    <body id="main_body"> <img alt="" src="../css/top.png" id="top" />
        <div id="form_container">
            <h1><a>Materias Disponibles</a></h1>
            <form action="validar_materias_admin.php" method="post" class="appnitro" id="materias_disponibles">
                <div class="form_description">
                    <h2 align="center">Materias Disponibles</h2>
                    <p align="center">Esta es la lista de materias que se encuentran
                        diponibles para ser abiertas</p>
                    <p align="center">Profesor: <?php
$nombre = $_GET['nombre'] . " " . $_GET['apellido'];
echo $nombre;
?></p>
                </div>
                <ul>
                    <li id="li_1"> <label for="element_1" class="description">Materias
                            Disponibles </label> <span> 
                            <?
                            $DB_NAME = 'tesis';
                            $DB_HOST = 'localhost';
                            $DB_USER = 'gach';
                            $DB_PASS = 'gach18942bakuryu';

                            $mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);

                            if (mysqli_connect_errno()) {
                                printf("Connect failed: %s\n", mysqli_connect_error());
                                exit();
                            }
                            $cedula = intval($_GET['cedula']);
                            $query = "SELECT idmateria,idseccion from tesis.materia WHERE statusmateria=0";
                            $res = $mysqli->multi_query($query) or die($mysqli->error . __LINE__);
                            $materias = array();
                            if ($res) {

                                do {
                                    if ($result = $mysqli->store_result()) {
                                        while ($row = $result->fetch_row()) {
                                            array_push($materias, $row);

                                            ;
                                        }
                                        $result->close();
                                    }
                                } while ($mysqli->next_result());
                            }
                            $mysqli->close();
                            for ($i = 0; $i < count($materias); $i++) {
                                ?>


                                <input id="materia_<? echo $i; ?>" name="materia_<? echo $i; ?>" class="materia check" type="checkbox" value="<?= $materias[$i][0] . "/" . $materias[$i][1] ?>" />
                                <label class="choice" for="materia_1_<? echo $i; ?>"><?= $materias[$i][0] . "  Seccion: " . $materias[$i][1] ?></label>
                                <?
                            }
                            ?>



                            <p id="guide_1" class="guidelines"><small>Elija las materia para
                                    abrir</small></p>
                        </span>
                    </li>
                    <li class="buttons"> <input type="hidden" value="materias_disponibles" name="form_id" />
                        <input type="submit" value="Activar" name="submit" class="button_text"
                               id="saveForm" /> </li>
                </ul>
            </form>
            <div id="footer"> Sistema de Evaluación Docente <a href="http://www.ucab.edu.ve">UCAB</a>
            </div>
        </div>
        <img alt="" src="../css/bottom.png" id="bottom" />
    </body>
</html>

